home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3643 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.6 KB  |  74 lines

  1. Path: nntp.msstate.edu!phoenix!topher
  2. From: topher@ERC.MsState.Edu (John Christopher Lakey)
  3. Newsgroups: comp.lang.c++
  4. Subject: expression must have class type
  5. Date: 25 Jan 1996 05:31:46 GMT
  6. Organization: Mississippi State University
  7. Message-ID: <4e74k2$jku@NNTP.MsState.Edu>
  8. NNTP-Posting-Host: phoenix.erc.msstate.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I get this error when I use a constructor with no args,
  12. but not when I use one with an arguement.
  13.  
  14.  
  15. Here's a code example:
  16.  
  17. class NexRadMessage {
  18. public:
  19.  
  20.   NexRadMessage();
  21.   //NexRadMessage(char *filename);
  22.   ~NexRadMessage();
  23.  
  24.   ...
  25.  
  26. };
  27.  
  28.  
  29. NexRadMessage::NexRadMessage()
  30. {
  31.   _messageCode = -1;
  32. }
  33.  
  34. NexRadMessage::NexRadMessage(char *filename)
  35. {
  36.   if (filename)
  37.     loadMessage(filename);
  38.   else _messageCode = -1;
  39. }
  40.  
  41.  
  42. main(int argc,char **argv)
  43. {
  44.  
  45.   //NexRadMessage message("argv[1]");  // tested and works (so far).
  46.   NexRadMessage message();
  47.  
  48.   message.loadMessage(argv[1]);
  49.  
  50. }
  51.  
  52. "nexrad.C", line 106: error(3240): expression must have class type
  53.     message.loadMessage(argv[1]);
  54.     ^
  55.  
  56.  
  57.  
  58.  
  59.  
  60. This work fine if I use the first declaration, but not the second.
  61. Any clue what I've done wrong?   I'm using IRIX 5.3 (NCC) C++
  62.  
  63.    c++_dev.sw.c++       10/16/95  C++ Compiler
  64.  
  65.  
  66.  
  67. *********************************************************************
  68. |  Chris<topher> Lakey                mailto:topher@pobox.com       
  69. |  Computer Engineer                  voice:      205 534-4844           
  70. |  Physitron Inc.                     fax:        205 534-4846           
  71. |  Huntsville, AL                     http://www.pobox.com/~topher   
  72. *********************************************************************
  73.  
  74.